#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>

/*int main(){

FILE* fp=fopen("bite.txt","w+");
if(!fp){
printf("fopen error!\n");
}
//const char* str="linux so easy!";
fwrite(str,sizeof(char),strlen(str),fp);
fseek(fp,0,SEEK_SET);
char Buffer[128];
size_t s=fread(Buffer,sizeof(char),sizeof(Buffer)-1,fp);
if(s>0)Buffer[s]=0;
printf("%s\n",Buffer);
fclose(fp);
return 0;
}
*/

int main(){
int fd=open("bite",O_RDWR|O_CREAT,0666);
if(fd<0){
  perror("open");
  return 1;
} 
const char* str="i like linux!";   
  write(fd,str,strlen(str));
  lseek(fd,0,SEEK_SET);
char buf[128];
size_t s=read(fd,buf,sizeof(buf)-1);

buf[s]=0;
printf("%s\n",buf);
close(fd);
  return 0;
}


